package jicheng;

//用户名密码登录管理

import java.util.Scanner;

public class StringTest01 {
    public static void main(String[] args) {

        String passname = "wzl";
        String password = "123";

        for (int i = 0; i < 3; i++) {

            Scanner sc = new Scanner(System.in);

            System.out.println("请输入用户名：");
            String name = sc.nextLine();

            System.out.println("请输入密码：");
            String world = sc.nextLine();

            if (name.equals(passname) && world.equals(password)) {
                System.out.println("恭喜你，登录成功！");
                break;
            }
            if (i == 2) {
                System.out.println("登录失败，请与管理员联系！");
            } else {
                System.out.println("你还有" + (2 - i) + "次登录机会");
            }
        }
    }
}